package com.nc.delivery_project.shared.servicelocator;

import com.google.web.bindery.requestfactory.shared.ServiceLocator;
import com.nc.delivery_project.server.service.CargoService;

/**
 * Created with IntelliJ IDEA.
 * User: Natalie D.
 * Date: 1/26/15
 * Time: 9:34 PM
 */
public class CargoServiceLocator implements ServiceLocator {

    private static CargoService serviceInstance;

    @Override
    public Object getInstance(Class<?> clazz) {
        return CargoServiceLocator.getServiceInstance();
    }

    private static CargoService getServiceInstance() {
        if (serviceInstance == null) {
            serviceInstance = new CargoService();
        }

        return serviceInstance;
    }
}